eventを色分けする (react-big-calendar)
react-big-calendarで/icons/Google Calendar.iconみたく色分けする方法を探している
こんな感じにoptionを渡せばいい
eventPropGetterに設定する
Webpack App
code:tsx
const events = {
type: 'record',
start: ...,
end: ...,
};
<Calendar
events={events}
localizer={localizer}
startAccessor="start"
endAccessor="end"
defaultView="day"
eventPropGetter={({ type }) => {
switch (type) {
case 'record':
return {};
case 'schedule':
return {style:{backgroundColor:'skyblue'}};
}
return {};
}}
/>
とりあえずIssuesからそれっぽいのを引っ張り出してきた
How to highlight selected day or days in react big calendar · Issue #1678 · jquense/react-big-calendar · GitHub
多分一番近い
customised timeslot bg color change the hours column as well · Issue #1766 · jquense/react-big-calendar · GitHub
How to change color of the day (rbc-date-cell) · Issue #1744 · jquense/react-big-calendar · GitHub
#2020-12-07 14:38:25
#2020-12-03 19:48:19